package com.school.gift.controller.admin;

import com.github.pagehelper.PageInfo;
import com.school.gift.domain.Skim;
import com.school.gift.service.SkimService;
import com.school.support.base.AdminBaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import zhibi.common.support.base.Page;
import zhibi.common.support.mybatis.example.Example;
import zhibi.common.support.mybatis.example.ExampleType;
import zhibi.common.support.mybatis.example.ExampleUtil;

/**
 * Created by 执笔 on 2017/3/21.
 */
@RequestMapping("admin/skim")
@Controller
public class MSkimController extends AdminBaseController {
    @Autowired
    private SkimService skimService;


    @RequestMapping("list")
    public String list(String startTime, String endTime, Page page, Model model){
        Example example = ExampleUtil.getInstance()
                .addParam("addtime", startTime, ExampleType.Operation.GTE)
                .addParam("addtime", endTime, ExampleType.Operation.LTE)
                .addOrder("addtime", ExampleType.OrderType.DESC)
                .getExample();
        PageInfo<Skim> pageInfo = skimService.selectByExample(example, page);
        setModelAttribute(model, pageInfo);
        return "admin/skim/list";
    }


}
